package com.ibeeking.found.open.api.feign;

import com.ibeeking.found.common.entity.KeyValue;
import com.ibeeking.found.open.api.common.dto.*;
import com.ibeeking.found.open.api.common.param.CouponVerificationParam;
import com.ibeeking.found.open.api.common.param.CouponVerificationQRParam;
import com.ibeeking.found.open.api.common.param.ModifyCouponStatusParam;
import com.ibeeking.found.open.api.common.query.*;
import com.ibeeking.found.open.api.feign.fallback.MarketingFeignFallbackFactory;
import com.ibeeking.nematos.utils.base.page.Page;
import com.ibeeking.nematos.utils.result.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @Author ibeeking
 */
@FeignClient(name = "mall-marketing-c-server", path = "/c", contextId = "openMarketingFeignClient", fallbackFactory = MarketingFeignFallbackFactory.class, decode404 = true)
public interface MarketingFeignClient {

    /**
     * 查询会员指定店铺券列表
     *
     * @param query
     * @return
     */
    @PostMapping(value = "/memberCoupon/feign/v1/list")
    ResponseResult<Page<MemberCouponListDTO>> shopMemberCouponList(@RequestBody ShopMemberCouponPageQuery query);

    /**
     * 查询券类型
     *
     * @return
     */
    @PostMapping(value = "/coupon/feign/v1/queryCouponTypes")
    ResponseResult<List<KeyValue<Integer, String>>> queryCouponTypes();

    /**
     * 查询券核销渠道
     *
     * @return
     */
    @PostMapping(value = "/coupon/feign/v1/queryVerificationChannel")
    ResponseResult<List<KeyValue<Integer, String>>> queryVerificationChannel();

    /**
     * 通过券码查询券信息
     *
     * @param couponCode
     * @return
     */
    @PostMapping(value = "/memberCoupon/feign/v1/queryCouponInfoByCouponCode/{couponCode}")
    ResponseResult<MemberCouponInfoDTO> queryCouponInfoByCouponCode(@PathVariable(value = "couponCode") Long couponCode);

    /**
     * 锁定优惠券
     *
     * @param param
     * @return
     */
    @PostMapping(value = "/memberCoupon/feign/v1/lockCoupon")
    ResponseResult<Boolean> lockCoupon(@RequestBody ModifyCouponStatusParam param);

    /**
     * 解锁优惠券
     *
     * @param param
     * @return
     */
    @PostMapping(value = "/memberCoupon/feign/v1/unLockCoupon")
    ResponseResult<Boolean> unLockCoupon(@RequestBody ModifyCouponStatusParam param);

    /**
     * 核销优惠券
     *
     * @param params
     * @return
     */
    @PostMapping(value = "/memberCoupon/feign/v1/verificationCoupon")
    ResponseResult<Boolean> verificationCoupon(@RequestBody List<CouponVerificationParam> params);

    /**
     * 通过二维码，金额核销优惠券
     *
     * @param param
     * @return
     */
    @PostMapping(value = "/memberCoupon/feign/v1/verificationCouponByQr")
    ResponseResult<Boolean> verificationCouponByQr(@RequestBody CouponVerificationQRParam param);

    /**
     * 扫码查询券码
     *
     * @param qrCode
     * @return
     */
    @PostMapping(value = "/coupon/feign/v1/queryCouponCodeByQRCode/{qrCode}")
    ResponseResult<MemberCouponQRDTO> queryCouponCodeByQRCode(@PathVariable(value = "qrCode") String qrCode);

    /**
     * 选券
     *
     * @param query
     * @return
     */
    @PostMapping(value = "/memberCoupon/feign/v1/confirmOrderCoupon")
    ResponseResult<ConfirmOrderCouponDTO> confirmOrderCoupon(@RequestBody ConfirmOrderCouponQuery query);

    /**
     * 查询活动
     *
     * @param query
     * @return
     */
    @PostMapping(value = "/campaign/feign/v1/campaignListForErp")
    ResponseResult<Page<CampaignListDTO>> campaignList(@RequestBody CampaignPageQuery query);


    /**
     * 查询活动核销统计
     *
     * @param query
     * @return
     */
    @PostMapping(value = "/campaign/feign/v1/campaignStatistics")
    ResponseResult<CampaignStatisticsDTO> campaignStatistics(@RequestBody CampaignStatisticsQuery query);

    /**
     * 查询活动分摊
     *
     * @param query
     * @return
     */
    @PostMapping(value = "/campaign/feign/v1/campaignDivide")
    ResponseResult<List<CampaignDivideScaleDTO>> campaignDivide(@RequestBody ShareScaleQuery query);

    /**
     * 查询券码和商品关系
     *
     * @param query
     * @return
     */
    @PostMapping(value = "/coupon/feign/v1/queryCouponGoodsRelation")
    ResponseResult<List<CouponGoodsDTO>> queryCouponGoodsRelation(@RequestBody CouponGoodsQuery query);
}
